﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Miao.ML
{
    /// <summary>
    /// 无形参方法存储
    /// </summary>
    public class MulticastMethodData : WinMLData, IEnumerable<MethodData>, IEnumerable
    {
        //public Type delegateType;
        public List<MethodData> methodDataList = new List<MethodData>();

        public MulticastMethodData()
        {

        }

        public void AddMethod(MethodData methodData)
        {
            methodDataList.Add(methodData);
        }

        public void RemoveMethod(MethodData methodData)
        {
            methodDataList.Remove(methodData);
        }

        public override string ToString()
        {
            string text = default;
            foreach (MethodData mehod in methodDataList)
            {
                text += mehod.ToString();
            }
            return text;
        }

       

        public IEnumerator<MethodData> GetEnumerator()
        {
           return methodDataList.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
          return GetEnumerator();
        }

        public override DataType type => DataType.Method;
    }
}
